package com.zuser.project.controller;


import com.zuser.project.entity.DriverInfoEntity;
import com.zuser.project.service.DriverInfoService;
import com.zuser.project.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;

/**
 * 司机表
 *
 * @author zuser
 * @email 2076033693@gmail.com
 * @date 2025-04-01 14:49:39
 */
@RestController
@RequestMapping("/driver/driverinfo")
public class DriverInfoController {
    @Autowired
    private DriverInfoService driverInfoService;

    /**
     * 列表
     */
    @GetMapping("/list")
    //("generator:driverinfo:list")
    public R list(@RequestParam Map<String, Object> params){
        return driverInfoService.queryPage(params);


    }


    /**
     * 信息
     */
 @GetMapping("/info/{id}")    //("generator:driverinfo:info")
    public R info(@PathVariable("id") Long id){
		DriverInfoEntity driverInfo = driverInfoService.getById(id);

        return R.ok().put("driverInfo", driverInfo);
    }

    /**
     * 保存
     */
     @PostMapping("/save")
    //("generator:driverinfo:save")
    public R save(@RequestBody DriverInfoEntity driverInfo){
		driverInfoService.save(driverInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    //("generator:driverinfo:update")
    public R update(@RequestBody DriverInfoEntity driverInfo){
		driverInfoService.updateById(driverInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    //("generator:driverinfo:delete")
    public R delete(@RequestBody Long[] ids){
		driverInfoService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
